/**
 * Alumno.java
 *
 * Fecha de creación: Apr 23, 2012,5:46:58 PM
 *
 * Autor: José Ignacio Rivero Dávila
 */

package org.examat.entidades;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;


@Entity
@Table(name = "Alumno")
@NamedQueries({
    @NamedQuery(name = "Alumno.findAll", query = "SELECT a FROM Alumno a"),
    @NamedQuery(name = "Alumno.findByClaveUnica", query = "SELECT a FROM Alumno a WHERE a.claveUnica = :claveUnica"),
    @NamedQuery(name = "Alumno.findByAPaterno", query = "SELECT a FROM Alumno a WHERE a.aPaterno = :aPaterno"),
    @NamedQuery(name = "Alumno.findByAMaterno", query = "SELECT a FROM Alumno a WHERE a.aMaterno = :aMaterno"),
    @NamedQuery(name = "Alumno.findByNombre", query = "SELECT a FROM Alumno a WHERE a.nombre = :nombre"),
    @NamedQuery(name = "Alumno.findByEmail", query = "SELECT a FROM Alumno a WHERE a.email = :email"),
    @NamedQuery(name = "Alumno.findByFechaInicioExamen", query = "SELECT a FROM Alumno a WHERE a.fechaInicioExamen = :fechaInicioExamen"),
    @NamedQuery(name = "Alumno.findByPassword", query = "SELECT a FROM Alumno a WHERE a.password = :password")})
public class Alumno implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ClaveUnica")
    private Integer claveUnica;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "APaterno")
    private String aPaterno;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "AMaterno")
    private String aMaterno;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "Nombre")
    private String nombre;
    // @Pattern(regexp="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", message="Invalid email")//if the field contains email address consider using this annotation to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "Email")
    private String email;
    @Column(name = "FechaInicioExamen")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaInicioExamen;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "Password")
    private String password;

    public Alumno() {
    }

    public Alumno(Integer claveUnica) {
        this.claveUnica = claveUnica;
    }

    public Alumno(Integer claveUnica, String aPaterno, String aMaterno, String nombre, String email, String password) {
        this.claveUnica = claveUnica;
        this.aPaterno = aPaterno;
        this.aMaterno = aMaterno;
        this.nombre = nombre;
        this.email = email;
        this.password = password;
    }

    public Integer getClaveUnica() {
        return claveUnica;
    }

    public void setClaveUnica(Integer claveUnica) {
        this.claveUnica = claveUnica;
    }

    public String getAPaterno() {
        return aPaterno;
    }

    public void setAPaterno(String aPaterno) {
        this.aPaterno = aPaterno;
    }

    public String getAMaterno() {
        return aMaterno;
    }

    public void setAMaterno(String aMaterno) {
        this.aMaterno = aMaterno;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Date getFechaInicioExamen() {
        return fechaInicioExamen;
    }

    public void setFechaInicioExamen(Date fechaInicioExamen) {
        this.fechaInicioExamen = fechaInicioExamen;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (claveUnica != null ? claveUnica.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Alumno)) {
            return false;
        }
        Alumno other = (Alumno) object;
        if ((this.claveUnica == null && other.claveUnica != null) || (this.claveUnica != null && !this.claveUnica.equals(other.claveUnica))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.examat.entidades.Alumno[ claveUnica=" + claveUnica + " ]";
    }

}
